package demoFactoryproxy;

import com.bit.utils.FileUtils;

public class Test {

    public static void main(String[] args) {
        UserFactory adimUserFactory = new AdminFactory();
        User admin = adimUserFactory.createUser("唐僧", 100);

        UserFactory normalUserFactory = new NormalUserFactory();
        User normal1 = normalUserFactory.createUser("孙悟空", 1000);
        User normal2 = normalUserFactory.createUser("猪八戒", 800);

        // 使用代理模式
        ProxyUser proxyUserAdmin = new ProxyUser(admin);
        proxyUserAdmin.borrowBook("西游记");
        proxyUserAdmin.addBook("西游记");

        ProxyUser proxyUserNormal = new ProxyUser(normal1);
        proxyUserNormal.addBook("水浒传");
        proxyUserNormal.borrowBook("西游记");


    }

    public static void main1(String[] args) {
        AdminUser adminUser = new AdminUser("唐僧", 100);
        NormalUser normalUser1 = new NormalUser("孙悟空", 1000);
        NormalUser normalUser2 = new NormalUser("猪八戒", 800);
    }
}
